import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"
import VueJsx from '@vitejs/plugin-vue-jsx'
import svgLoader from 'vite-svg-loader'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), VueJsx(), svgLoader()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@import "@/assets/style/common.scss";'
      }
    }
  },
  // 跨域配置代理
  server: {
    proxy: {
      '/api': {
        target: 'https://api.vvhan.com/api',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, '')
      }
    }
  }
})
